package chongxie;

public class Pet {
    //封装
    private String name;
    private String sex;
    private int health;
    private int love;
    //无参构造方法
    public Pet(){}
    //有参构造方法
    public Pet(String name, String sex, int health, int love) {
        this.name = name;
        this.sex = sex;
        this.health = health;
        this.love = love;
    }
    //set和get方法

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        this.love = love;
    }
    //父类的输入方法
    public void print(){
        System.out.println("宠物的自白");
        System.out.println("我叫:"+name+"性别"+sex+"亲密度:"+love);
    }
}
